<?php

@include_once('connect.php');
//前端数据
$res = [];

$id = $_POST['id'];

if ($id) {
    //删除card_id,删除这条数据,前端接受数据
    $sql = "DELETE FROM cart2 WHERE cart_id = $id";
    $ggo = mysqli_query($connect, $sql);
    //$ggo是一个数字，受影响的行数

    if ($ggo > 0) {
        $res['status'] = true;
        $res['msg'] = '删除成功';
    } else {
        $res['status'] = false;
        $res['msg'] = '数据库错误';
    }
} else {
    $res['status'] = false;
    $res['msg'] = '前端数据错误';
}
echo(json_encode($res,JSON_UNESCAPED_UNICODE));